package com.example.order.message;

import com.example.order.util.Console;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MqReceiver {
//    @RabbitListener(queues = "myQueues")
//    自动创建队列  @RabbitListener(queuesToDeclare = @Queue("myQueue"))
//    自动创建，Exchange和Queue绑定
    /*@RabbitListener(bindings = @QueueBinding(value =@Queue("myQueue"),exchange = @Exchange("myExchange")))
    public void process(String msg) throws JsonProcessingException {
        Console.log("myQueues",msg);
    }*/

    /**
     * 数码供应商服务 接受参数
     * @param msg
     * @throws JsonProcessingException
     */
 /*   @RabbitListener(bindings = @QueueBinding(value =@Queue("computeOrder")
                                            ,exchange = @Exchange("myOrder")
                                            ,key = "compute"))
    public void processCompute(String msg) throws JsonProcessingException {
        Console.log("computeOrder",msg);
    }*/
    /**
     * 水果供应商服务 接受参数
     * @param msg
     * @throws JsonProcessingException
     */
    /*@RabbitListener(bindings = @QueueBinding(value =@Queue("fruitOrder")
                                            ,exchange = @Exchange("myOrder")
                                            ,key = "fruit"))
    public void processFruit(String msg) throws JsonProcessingException {
        Console.log("fruitOrder",msg);
    }*/

}
